## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>
<%namespace file="/component/navigation.html" import="header_nav, header_nav2" />
<%namespace file="/component/utils.html" import="*" />
<%!
    from pythonblog.service.user_service import get_user_by_id
    from pythonblog.service.content_service import get_post
%>

<div class="span-24 last bodyWrapper">
    <div class="span-17 bodyWrapper2">
        ${next.body()}
    </div>
    <div class="span-7 last" >
        <div id="adWrapper" style="margin-top:16px;"></div>
        <div class="bar">
            <h3>作者排行榜</h3>
        </div>
        <div style="margin: 5px 0 0 10px;">
            <ol class="hot_authors">
                %for id, viewTimes in c.top_users:
                <li>
                    <p>
                        <% user = get_user_by_id(id) %>
                        ${link_for_user(user.userName, user.author)}
                        <span title="浏览: ${viewTimes}次" >${viewTimes}</span>
                    </p>
                </li>
                %endfor
            </ol>
        </div>
        <div class="bar">
            <h3>精品文章推荐</h3>
        </div>
        <div style="margin: 5px 0 0 10px;">
            <ul class="recommends">
                %for id in c.recommand_posts:
                <% post = get_post(id) %>
                <li>
                    <p>
                        ${link_for_post(post)}
                        <span style="padding-left: 5px;"/>文 / ${link_for_user(post.user.userName, post.user.author)}
                    </p>
                </li>
                %endfor
            </ul>
        </div>
    </div>
</div>

<%def name="head()">
${parent.head()}
${h.stylesheet_link(h.url_for('/css/home.css'))}
${h.javascript_link(h.url_for('/js/swfobject.js'))}
<script type="text/javascript">
    $(document).ready(function() {
        // <![CDATA[
        var so = new SWFObject("${h.url_for('/flash/ad.swf')}", "setout", "260", "200", "9");
        so.useExpressInstall("${h.url_for('/flash/expressinstall.swf')}");
        so.write("adWrapper");
        // ]]>
    });
</script>
</%def>

<%def name="header()">
${header_nav()}
${header_nav2()}
</%def>